var deleteNode = function (head, val) {
    let cur = head

    if (head.val === val) {//要移除头节点
        head = head.next
    }

    while (cur && cur.next) {//cur和cur.next都存在
        if (cur.next.val === val) {
            //cur.next就是要被移除的节点
            cur.next = cur.next.next

        }
        cur = cur.next
    }

    return head
};